package com.losl.framework.controller;


import com.losl.common.core.domain.Result;
import com.losl.common.core.domain.entity.SysUser;
import com.losl.system.service.impl.SysUserServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(value = "注册-API",tags = "注册相关接口")
public class UserRegisterController {
    @Autowired
    private SysUserServiceImpl userService;

    @ApiOperation("注册用户")
    @ApiParam(name = "用户实体",value = "用户类",type = "用户类")
    @PostMapping("/register")
    public Result register(@RequestBody SysUser user) {
        boolean register = userService.register(user);
        if (register) {
            return Result.success("注册成功");
        }
        return Result.error("用户已存在");
    }
}
